<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@taglib prefix="sec"
	uri="http://www.springframework.org/security/tags"%>


<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base href="<%=basePath%>" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>${applicationScope.KEY_SITE_NAME}</title>


<link href="resources/css/intstyle.css" rel="stylesheet" type="text/css" />
<link href="resources/css/jquery-ui.css" rel="stylesheet"
	type="text/css" />

<script type="text/javascript" src="resources/scripts/jquery-1.9.1.js"></script>
<script type="text/javascript"
	src="resources/scripts/jquery-ui.custom.js"></script>
<script type="text/javascript" src="resources/scripts/jquery.blockUI.js"></script>
<script type="text/javascript" src="resources/scripts/common.js"></script>
<script type="text/javascript"
	src="resources/scripts/jquery.validate.js"></script>

<script>
<!--
	$(document)
			.ready(
					function() {
						renderButtons();
						changeSideMenuBackColor("sideMenuKeywords");

						$("#form1")
								.validate(
										{
											rules : {
												KEY_SITE_NAME : {
													required : true,
													maxlength : 400
												},
												KEY_COPYRIGHT : {
													required : true,
													maxlength : 400
												},
												KEY_KEYWORDS : {
													maxlength : 400
												},
												KEY_DESC : {
													maxlength : 400
												},
												KEY_EMAIL : {
													required : true,
													email: true
												},
												KEY_MAIL_PSW : {
													required : true,
													maxlength : 150
												},
												KEY_MAIL_SERVER : {
													required : true,
													maxlength : 150
												}
											},
											messages : {
												
												KEY_SITE_NAME : {
													required : "<spring:message code='msg.input.field.required'/>",
													maxlength : jQuery.format("<spring:message code='msg.input.field.maxlength'/>")
												},
												KEY_COPYRIGHT : {
													required : "<spring:message code='msg.input.field.required'/>",
													maxlength : jQuery.format("<spring:message code='msg.input.field.maxlength'/>")
												},
												KEY_KEYWORDS : {
													maxlength : jQuery.format("<spring:message code='msg.input.field.maxlength'/>")
												},
												KEY_DESC : {
													maxlength : jQuery.format("<spring:message code='msg.input.field.maxlength'/>")
												},
												KEY_EMAIL : {
													required : "<spring:message code='msg.input.field.required'/>",
													email : "<spring:message code='msg.input.email.format'/>"
												},
												KEY_MAIL_PSW : {
													required : "<spring:message code='msg.input.field.required'/>",
													maxlength : jQuery.format("<spring:message code='msg.input.field.maxlength'/>")
												},
												KEY_MAIL_SERVER : {
													required : "<spring:message code='msg.input.field.required'/>",
													maxlength : jQuery.format("<spring:message code='msg.input.field.maxlength'/>")
												}
											},

											submitHandler : function(form) {
												updateSiteInfo();
											}

										});

					});

	function updateSiteInfo() {		

		getBlockUI();

		$.post("admin/site/update", $("#form1").serialize(), function(data,
				html) {
			$.unblockUI();
			if (data.accessDenied) {
				showInfoDialog("error",data.message);	
			} else {
				showInfoDialog("success","<spring:message code='msg.dialog.save.ok'/>");				
			}
		});
	}
//-->
</script>

<!--[if lte IE 7]>
<style>
.content { margin-right: -1px; } /* 此 1px 负边距可以放置在此布局中的任何列中，且具有相同的校正效果。 */
ul.nav a { zoom: 1; }  /* 缩放属性将为 IE 提供其需要的 hasLayout 触发器，用于校正链接之间的额外空白 */
</style>
<![endif]-->
</head>

<body>

	<div class="container">
		<%@include file="../header.jsp"%>
		<%@include file="sidebar.jsp"%>
		<div id="contentBoxDiv" class="content">
			<div class="subnav">
			<spring:message code="Label.menu.headnav.site"/>&gt;&gt;
			<spring:message code="Label.menu.sidenav.site.title.info"/>&gt;&gt;
			<spring:message code="Label.menu.sidenav.site.keywords"/>
			</div>
			<%@include file="../errorMessagePanel.jsp"%>

			<div class="box">

					<h2>
						<spring:message code="Label.siteinfo.main" />
					</h2>

					<form id="form1" name="form1" method="post" action="">

						<fieldset>
							<div class="formfield">

								<div class="formLabel">
									<label for="sitename"><spring:message
											code="Label.siteinfo.name" /></label>
								</div>
								<div class="forminput">
									<input type="text" id="sitename" name="KEY_SITE_NAME"
										class="text ui-widget-content ui-corner-all"
										value="${settings.KEY_SITE_NAME}" />
								</div>

							</div>

							<div class="formfield">
								<div class="formLabel">
									<label for="copyright"><spring:message
											code="Label.siteinfo.copyright" /></label>
								</div>
								<div class="forminput">
									<input type="text" id="copyright" name="KEY_COPYRIGHT"
										class="text ui-widget-content ui-corner-all"
										value="${settings.KEY_COPYRIGHT}" />
								</div>
							</div>


							<div class="formfield">

								<div class="formLabel" style="vertical-align: top;">
									<label for="keywords"><spring:message
											code="Label.siteinfo.keywords" /></label>
								</div>
								<div class="forminput">
									<textarea id="keywords" name="KEY_KEYWORDS" cols="65" rows="8"
										class="text ui-widget-content ui-corner-all">${settings.KEY_KEYWORDS}</textarea>
								</div>
							</div>

							<div class="formfield">

								<div class="formLabel" style="vertical-align: top;">
									<label for="description"><spring:message
											code="Label.siteinfo.description" /></label>
								</div>
								<div class="forminput">
									<textarea id="description" name="KEY_DESC" cols="65" rows="8"
										class="text ui-widget-content ui-corner-all">${settings.KEY_DESC}</textarea>
								</div>
							</div>

							<div class="formfield">
								<div class="formLabel">
									<label for="email"><spring:message
											code="Label.siteinfo.email" /></label>
								</div>
								<div class="forminput">
									<input type="text" id="email" name="KEY_EMAIL"
										class="text ui-widget-content ui-corner-all"
										value="${settings.KEY_EMAIL}" />
								</div>
							</div>

							<div class="formfield">
								<div class="formLabel">
									<label for="mailpassword"><spring:message
											code="Label.siteinfo.mail.password" /></label>
								</div>
								<div class="forminput">
									<input type="password" id="mailpassword" name="KEY_MAIL_PSW"
										class="text ui-widget-content ui-corner-all"
										value="${settings.KEY_MAIL_PSW}" />
								</div>
							</div>

							<div class="formfield">
								<div class="formLabel">
									<label for="mailserver"><spring:message
											code="Label.siteinfo.mail.server" /></label>
								</div>
								<div class="forminput">
									<input type="text" id="mailserver" name="KEY_MAIL_SERVER"
										class="text ui-widget-content ui-corner-all"
										value="${settings.KEY_MAIL_SERVER}" />
								</div>
							</div>
							<div class="forminput">
								<button type="submit" id="submitbtn">
									<spring:message code='Label.common.save' />
								</button>
								<button type="reset" id="reset">
									<spring:message code='Label.common.reset' />
								</button>
							</div>

						</fieldset>
					</form>
			</div>

			<!-- end .content -->
		</div>
		<div class="clearfloat" />
		<%@include file="../footer.jsp"%>
		<!-- end .container -->
	</div>
</body>
</html>